import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// 去除引用自动导入插件,自动导入并没有在头部导入,eslint prettier会报错
// import AutoImport from 'unplugin-auto-import/vite'

import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
import pxToViewport from 'postcss-px-to-viewport'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    react(),
    // AutoImport({
    //   imports: ['react', 'react-router-dom'],
    //   dts: './src/auto-imports.d.ts',
    // }),
  ],
  css: {
    postcss: {
      plugins: [
        tailwindcss(),
        autoprefixer(),
        pxToViewport({
          viewportWidth: 1920,
          viewportHeight: 1080,
          unitPrecision: 5,
          viewportUnit: 'vw',
          selectorBlackList: [],
          minPixelValue: 1,
          mediaQuery: false
        })
      ]
    }
  }
})